import React from 'react'
import './style.less'
import { useNavigate } from 'umi'
type PropTypes = {
  items: any[]
}
export default function index(props: PropTypes) {
  const navigate = useNavigate();
  return (
    <div className='home-items'>
      <div className="items">
        {
          props.items.map(item => (
            <div onClick={
              () => {
                navigate(`/detail?id=${item.id}`)
              }
            } key={item.id} className="item">
              <img src={item.pic} alt="" />
              <div className="item-info">
                <h4>{item.name}</h4>
                <p>￥{item.minPrice}</p>
              </div>
            </div>
          ))
        }

      </div>
    </div>
  )
}
